#!/usr/bin/python

# Assign the users and passwords
users=['Fred','John','Steve','Mary']
passwords=['access','dog','kids','qwerty']

# Get username and password
username = raw_input('Enter your ID => ')

# Check
if username in users:
    retry=1
    position = users.index(username) # Get the position in the list of the users
    while retry<=3:
        pwd = raw_input('Enter your password => ')
        if pwd == passwords[position]:
            print('Hi, %s. Access granted.' % username)
            break
        else:
            print('Password incorrect. Access denied.')
        retry+=1
        #print('retry time:' + str(retry))
else:
    print('Sorry, wrong ID')

